package main

import (
	"gogogo-testing-ground/utils"
	"log"
)

func main() {
	//cliConf := new(utils.FtpClientConfig)
	//cliConf.CreateConn("192.168.247.128", 21, "ftpuser1", "root")
	//defer cliConf.Conn.Quit()
	//
	//FtpPath := "/home/ftpuser1"
	//LocalPath := "D:\\uploads\\test"
	//
	////遍历文件夹
	////sources, _ := cliConf.Listfiles(FtpPath)
	////for _, source := range sources {
	////	fmt.Println(source.Path)
	////}
	////下载文件夹
	//err := cliConf.DownloadDir(FtpPath, LocalPath)
	//if err != nil {
	//	log.Fatalln("连接发生错误:", err)
	//} else {
	//	fmt.Println("下载成功")
	//}

	cliConf := new(utils.FtpClientConfig)
	cliConf.CreateConn("61.184.234.14", 9221, "1", "1")
	defer cliConf.Conn.Quit()

	FtpPath := "/2022-07"
	LocalPath := "D:\\uploads\\"

	//遍历文件夹
	//sources, _ := cliConf.Listfiles(FtpPath)
	//for _, source := range sources {
	//	fmt.Println(source.Path)
	//}
	//下载文件夹
	err := cliConf.DownloadDir(FtpPath, LocalPath)
	if err != nil {
		log.Fatalln("连接发生错误:", err)
	} else {
		log.Println("下载成功")
	}

}
